

// 全局自定义指令
export default {
  // 装载的时候
  bind: function(el, binding) {
    console.log(el, binding);
    const option = binding.value;
    const { currIndex, className, activeClassName } = option;
    const curElement = el.getElementsByClassName(className)[currIndex];
    curElement.className += ` ${activeClassName}`;
  },
  // 数据更新的时候
  update: function(el, bingding) {
    // console.log(el, bingding);
    const { currIndex, className, activeClassName } = bingding.value;
    const { currIndex: oldCurIndex} = bingding.oldValue;
    const childElemnet =el.getElementsByClassName(className);
    childElemnet[oldCurIndex].className = className;
    childElemnet[currIndex].className += ` ${activeClassName}`;
  }
}